package views.activity;

import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JLabel;
import javax.swing.table.DefaultTableModel;

import java.awt.Font;

import views.activity.volunteer.*;

public class AddActivityView extends JPanel {
	
	public DefaultTableModel tblModelDetails;
	public JTable tblDetails;
	public AddActivitySubView panel0;
	public GeneralPanel vPanel1;
	public DatesPanel vPanel2;
	public StringListPanel vPanel3;
	public StringListPanel vPanel4;
	public ParticipantsPanel vPanel5;
	public RemarksPanel vPanel6;
	public ConfirmView confirmPanel;
	
	public AddActivityView() {
		this.setSize(750, 460);
		this.setLayout(null);
		
		JLabel lblAddAnActivity = new JLabel("Add an activity:");
		lblAddAnActivity.setFont(new Font("Arial Black", Font.PLAIN, 25));
		lblAddAnActivity.setBounds(220, 20, 520, 30);
		this.add(lblAddAnActivity);
		
		JScrollPane scrollPane = new JScrollPane();
		scrollPane.setBounds(10, 10, 200, 439);
		this.add(scrollPane);
		
		tblModelDetails = new DefaultTableModel(new Object[][] {}, new String[] { "Field", "Value" });
		
		tblDetails = new JTable(tblModelDetails) {
			public boolean isCellEditable(int row, int col) {
				return false;
			}
		};
		scrollPane.setViewportView(tblDetails);
		
		panel0 = new AddActivitySubView();
		panel0.setBounds(220, 60, 520, 389);
		panel0.setVisible(true);
		this.add(panel0);
		
		vPanel1 = new GeneralPanel();
		vPanel1.setBounds(220, 60, 520, 389);
		vPanel1.setVisible(false);
		this.add(vPanel1);
		
		vPanel2 = new DatesPanel();
		vPanel2.setBounds(220, 60, 520, 389);
		vPanel2.setVisible(false);
		this.add(vPanel2);
		
		vPanel3 = new StringListPanel("Beneficiary");
		vPanel3.setBounds(220, 60, 520, 389);
		vPanel3.setVisible(false);
		this.add(vPanel3);
		
		vPanel4 = new StringListPanel("Adviser");
		vPanel4.setBounds(220, 60, 520, 389);
		vPanel4.setVisible(false);
		this.add(vPanel4);
		
		vPanel5 = new ParticipantsPanel();
		vPanel5.setBounds(220, 60, 520, 389);
		vPanel5.setVisible(false);
		this.add(vPanel5);
		
		vPanel6 = new RemarksPanel();
		vPanel6.setBounds(220, 60, 520, 389);
		vPanel6.setVisible(false);
		this.add(vPanel6);
		
		confirmPanel = new ConfirmView();
		confirmPanel.setBounds(220, 60, 520, 389);
		confirmPanel.setVisible(false);
		this.add(confirmPanel);
	}
	
	public void displayVPanel0() {
		panel0.setVisible(true);
		vPanel1.setVisible(false);
		this.updateUI();
	}
	
	public void displayVPanel1() {
		panel0.setVisible(false);
		vPanel1.setVisible(true);
		vPanel2.setVisible(false);
		this.updateUI();
	}
	
	public void displayVPanel2() {
		vPanel1.setVisible(false);
		vPanel2.setVisible(true);
		vPanel3.setVisible(false);
		this.updateUI();
	}
	
	public void displayVPanel3() {
		vPanel2.setVisible(false);
		vPanel3.setVisible(true);
		vPanel4.setVisible(false);
		this.updateUI();
	}
	
	public void displayVPanel4() {
		vPanel3.setVisible(false);
		vPanel4.setVisible(true);
		vPanel5.setVisible(false);
		this.updateUI();
	}
	
	public void displayVPanel5() {
		vPanel4.setVisible(false);
		vPanel5.setVisible(true);
		vPanel6.setVisible(false);
		this.updateUI();
	}
	
	public void displayVPanel6() {
		vPanel5.setVisible(false);
		vPanel6.setVisible(true);
		confirmPanel.setVisible(false);
		this.updateUI();
	}
	
	public void displayConfirm() {
		vPanel6.setVisible(false);
		confirmPanel.setVisible(true);
	}
	
	public class AddActivitySubView extends JPanel {
		
		public JRadioButton rdbtnCurriculumbasedActivity;
		public JRadioButton rdbtnVolunteerbasedActivity;
		public JButton btnCancel;
		public JButton btnNext;
		
		public AddActivitySubView() {
			this.setSize(520, 389);
			this.setLayout(null);
			
			JLabel lblProgram = new JLabel("Program");
			lblProgram.setFont(new Font("Arial", Font.PLAIN, 12));
			lblProgram.setBounds(70, 10, 380, 20);
			this.add(lblProgram);
			
			rdbtnCurriculumbasedActivity = new JRadioButton("Curriculum-Based Activity");
			rdbtnCurriculumbasedActivity.setFont(new Font("Arial", Font.PLAIN, 12));
			rdbtnCurriculumbasedActivity.setBounds(70, 37, 380, 23);
			rdbtnCurriculumbasedActivity.setSelected(true);
			this.add(rdbtnCurriculumbasedActivity);
			
			rdbtnVolunteerbasedActivity = new JRadioButton("Volunteer-Based Activity");
			rdbtnVolunteerbasedActivity.setFont(new Font("Arial", Font.PLAIN, 12));
			rdbtnVolunteerbasedActivity.setBounds(70, 63, 380, 23);
			rdbtnVolunteerbasedActivity.setSelected(false);
			this.add(rdbtnVolunteerbasedActivity);
			
			btnCancel = new JButton("Cancel");
			btnCancel.setFont(new Font("Arial", Font.PLAIN, 12));
			btnCancel.setBounds(220, 353, 80, 25);
			this.add(btnCancel);
			
			btnNext = new JButton("Next");
			btnNext.setFont(new Font("Arial", Font.PLAIN, 12));
			btnNext.setBounds(370, 353, 80, 25);
			this.add(btnNext);
		}
		
	}
}
